package ar.org.tesis.comparticion.conocimientos.utils;

import org.springframework.beans.BeansException;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;

/**
 * @author mprieto
 *
 */
public class ApplicationContextProvider implements ApplicationContextAware {

	private static ApplicationContext applicationContext = null;
	
	public void setApplicationContext(ApplicationContext applicationContext)
			throws BeansException {
		// TODO Auto-generated method stub
		ApplicationContextProvider.applicationContext=applicationContext;

	}

	public static ApplicationContext getApplicationContext() {
		return applicationContext;
	}
	
	public static Object getService(String serviceName){
		return applicationContext.getBean(serviceName);
	}

}
